package cn.lenchu.data.h2.converter;

import cn.lenchu.data.h2.entity.UserEntity;
import cn.lenchu.data.model.User;
import org.springframework.beans.BeanUtils;

/**
 * @author lenchu
 */
public class UserConverter {

    public static User toUser(UserEntity userEntity) {
        User user = new User();
        BeanUtils.copyProperties(userEntity, user);
        return user;
    }

    public static UserEntity toUserEntity(User user) {
        UserEntity userEntity = new UserEntity();
        BeanUtils.copyProperties(user, userEntity);
        return userEntity;
    }
}
